/**
 * logmanager.h is part of cbs-framework.
 *
 * cbs-framework is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * cbs-framework is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with cbs-framework.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef LOGMANAGER_H
#define LOGMANAGER_H

#include <log4cpp/Category.hh>

// Forward declarations
class Logger;

#define GET_LOG_MGR() ( LogManager::Instance() )

typedef std::map< std::string, Logger * > tLoggers;

class LogManager
{
public:

    ~LogManager();

    static LogManager & Instance();

    void SubscribeFileLogger( const std::string & a_name, log4cpp::Priority::PriorityLevel a_priority = log4cpp::Priority::NOTSET );
    void SubscribeConsoleLogger( const std::string & a_name, log4cpp::Priority::PriorityLevel a_priority = log4cpp::Priority::NOTSET );

    const Logger * GetLogger( const std::string & a_name ) const;
    Logger * GetLogger( const std::string & a_name );

private:

    // Protect default copy constructor.
    LogManager( const LogManager & a_other );

    // Protect default operator =.
    LogManager & operator = ( const LogManager & a_other );

    LogManager();

    static LogManager m_instance;

    tLoggers m_loggers;
};

#endif // LOGMANAGER_H
